<?php
namespace App\Common\Cla\Weixin\MiniProgram;

use App\Common as com;
use App\Common\Cla\Weixin\MiniProgram as nameMiniProgram;

class AppCode extends nameMiniProgram\Base\OfConfig {

	/**
	 * 获取小程序二维码(临时)
	 * @param string $scene
	 * @param array $optional
	 * @return string
	 */
	public function getUnlimit( string $scene, array $optional = [] ):string {
		$response = $this->getEasyObj()->app_code->getUnlimit( $scene, $optional );
		if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
			return $response->getBodyContents();
		}elseif( is_array( $response ) ){
			throw com\Lib\Err\Exception::makeOfNew( $response['errmsg'], com\Lib\Err\Code::$apiSysError );
		}else{
			throw com\Lib\Err\Exception::makeOfNew( '', com\Lib\Err\Code::$sysAssertError );
		}
	}

}
